package com.ruoyi.ctcx.service.impl;

import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ctcx.mapper.TbInsuranceContractRiskPlanMapper;
import com.ruoyi.ctcx.domain.TbInsuranceContractRiskPlan;
import com.ruoyi.ctcx.service.ITbInsuranceContractRiskPlanService;

/**
 * 保险合同风控费用支付计划Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-22
 */
@Service
public class TbInsuranceContractRiskPlanServiceImpl implements ITbInsuranceContractRiskPlanService 
{
    @Autowired
    private TbInsuranceContractRiskPlanMapper tbInsuranceContractRiskPlanMapper;

    /**
     * 查询保险合同风控费用支付计划
     * 
     * @param id 保险合同风控费用支付计划主键
     * @return 保险合同风控费用支付计划
     */
    @Override
    public TbInsuranceContractRiskPlan selectTbInsuranceContractRiskPlanById(Long id)
    {
        return tbInsuranceContractRiskPlanMapper.selectTbInsuranceContractRiskPlanById(id);
    }

    /**
     * 查询保险合同风控费用支付计划列表
     * 
     * @param tbInsuranceContractRiskPlan 保险合同风控费用支付计划
     * @return 保险合同风控费用支付计划
     */
    @Override
    public List<TbInsuranceContractRiskPlan> selectTbInsuranceContractRiskPlanList(TbInsuranceContractRiskPlan tbInsuranceContractRiskPlan)
    {
        return tbInsuranceContractRiskPlanMapper.selectTbInsuranceContractRiskPlanList(tbInsuranceContractRiskPlan);
    }

    /**
     * 新增保险合同风控费用支付计划
     * 
     * @param tbInsuranceContractRiskPlan 保险合同风控费用支付计划
     * @return 结果
     */
    @Override
    public int insertTbInsuranceContractRiskPlan(TbInsuranceContractRiskPlan tbInsuranceContractRiskPlan)
    {
        tbInsuranceContractRiskPlan.setCreateTime(DateUtils.getNowDate());
        return tbInsuranceContractRiskPlanMapper.insertTbInsuranceContractRiskPlan(tbInsuranceContractRiskPlan);
    }

    /**
     * 修改保险合同风控费用支付计划
     * 
     * @param tbInsuranceContractRiskPlan 保险合同风控费用支付计划
     * @return 结果
     */
    @Override
    public int updateTbInsuranceContractRiskPlan(TbInsuranceContractRiskPlan tbInsuranceContractRiskPlan)
    {
        tbInsuranceContractRiskPlan.setUpdateTime(DateUtils.getNowDate());
        return tbInsuranceContractRiskPlanMapper.updateTbInsuranceContractRiskPlan(tbInsuranceContractRiskPlan);
    }

    /**
     * 批量删除保险合同风控费用支付计划
     * 
     * @param ids 需要删除的保险合同风控费用支付计划主键
     * @return 结果
     */
    @Override
    public int deleteTbInsuranceContractRiskPlanByIds(Long[] ids)
    {
        return tbInsuranceContractRiskPlanMapper.deleteTbInsuranceContractRiskPlanByIds(ids);
    }

    /**
     * 删除保险合同风控费用支付计划信息
     * 
     * @param id 保险合同风控费用支付计划主键
     * @return 结果
     */
    @Override
    public int deleteTbInsuranceContractRiskPlanById(Long id)
    {
        return tbInsuranceContractRiskPlanMapper.deleteTbInsuranceContractRiskPlanById(id);
    }

    @Override
    public BigDecimal getAllPlanAmountByRiskId(Long riskId) {
        return tbInsuranceContractRiskPlanMapper.getAllPlanAmountByRiskId(riskId);
    }
}
